package com.raymond.queue.common.msg.request;

import com.raymond.queue.common.enums.CommandIdType;
import com.raymond.queue.common.enums.GrowMode;
import com.raymond.queue.common.msg.DefaultMessage;

/**
 * 创建消费组请求
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-07-27 15:40
 */
public class CreateConsumptionRequest extends DefaultMessage {
    /**
     * topic名称
     */
    private String topic;
    /**
     * 消费组名称
     */
    private String groupName;
    /**
     * 0:从上次消费的开始,如果不存在上次消费,则按最后一条开始
     * 1:从当前最后一条开始
     * 2:从某个消费组开始
     * 3:从首条开始
     */
    private GrowMode growMode;
    /**
     * 来源消费组名称
     */
    private String srcGroupName;
    /**
     * 已存在情况下是否继续上次消费
     */
    private boolean isContinue;

    public CreateConsumptionRequest() {
        super(0);
    }

    public CreateConsumptionRequest(String topic, String groupName, GrowMode growMode, String srcGroupName, boolean isContinue) {
        super(0);
        this.topic = topic;
        this.groupName = groupName;
        this.growMode = growMode;
        this.srcGroupName = srcGroupName;
        this.isContinue = isContinue;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public GrowMode getGrowMode() {
        return growMode;
    }

    public void setGrowMode(GrowMode growMode) {
        this.growMode = growMode;
    }

    public String getSrcGroupName() {
        return srcGroupName;
    }

    public void setSrcGroupName(String srcGroupName) {
        this.srcGroupName = srcGroupName;
    }

    public boolean isContinue() {
        return isContinue;
    }

    public void setContinue(boolean aContinue) {
        isContinue = aContinue;
    }

    @Override
    public int getCommandId() {
        return CommandIdType.CREATE_CONSUMPTION_REQ.getCommandId();
    }
}
